package com.action.library;

import com.bean.library.Teacher;
import com.dao.DaoManager;
import com.dao.library.TeacherDao;

public class TLoginAction {
	public Teacher teacherLogin(String teacherId,String password){
		DaoManager dm = DaoManager.getInstance();
		TeacherDao teacherDao = dm.getDao(TeacherDao.class);
		Teacher teacher = null;	
		try
		{
			dm.begin();
			teacher = teacherDao.getTeacherByTeacherIdAndPassword(teacherId, password);
			dm.commit();
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
		finally 
		{
			dm.end();
		}
		return teacher;
	}
}
